﻿package view 
{
	import caurina.transitions.Tweener;
	import flash.events.Event;
	import model.MainModel;
	import view.components.TabsMenu;
	import view.containers.UserInfo;
	
	/**
	 * ...
	 * @author Slavshik Alexander
	 */
	public class AlbumsView extends AlbumsViewTemplate
	{
		private var userInfo:UserInfo = new UserInfo();
		private var tabs:TabsMenu;
		
		public function AlbumsView() {
			addEventListener(Event.ADDED_TO_STAGE, onAdded);
			tabs = new TabsMenu(["Альбомы", "Друзья"]);
			addChild(userInfo);
			addChild(tabs);
			tabs.x = userInfo.x = 13;
			tabs.addEventListener(Event.CHANGE, onScreenChanged);
		}
		
		private function onScreenChanged(e:Event):void {
			trace(e.currentTarget.selected);
		}
		private function onAdded(e:Event):void {
			alpha = 0;
			userInfo.gotoAndStop(MainModel.user.sex);
			userInfo.y = -userInfo.height;
			userInfo.user = MainModel.user;
			Tweener.addTween(userInfo, { y:13, time:0.5 } );
			Tweener.addTween(tabs, { y:23 + userInfo.height, time:0.5 } );
			Tweener.addTween(this, { alpha:1, time:0.5 } );
		}
		
	}
	
}